package com.qhg.saas_server.resolver;


import com.qhg.saas_server.MyException.roadNotFindExcepiton;
import com.qhg.saas_server.empty.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;


@ResponseBody
@ControllerAdvice(annotations = {RestController.class})
@Slf4j
public class globalExcptionHendler {

    //处理roadNotFindExcepiton
    @ExceptionHandler(roadNotFindExcepiton.class)
    public Result  roadNotFindExcepitonHandler(roadNotFindExcepiton e){

        return Result.error(e.getMessage());

    }
    @ExceptionHandler(Exception.class)
    public Result MyExceptionHandler(Exception e){

        return Result.error("系统错误");
    }


}
